package com.hippo.core.pojo.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

/**
 * @ClassName RequestLog
 * @Description TODO 操作日志
 * @Author tangxl
 * @create 2023-05-08 15:07
 **/
@TableName("sys_request_log")
@Data
@Schema(description = "通用地址实体类")
public class SysRequestLog {
    @Schema(description = "主键", example = "1")
    @TableId(value = "id",type = IdType.AUTO)
    private Integer id;
    /**
     * 操作描述
     */
    @Schema(description = "操作描述", example = "操作日志")
    @TableField(value = "description")
    private String description;

    /**
     * 操作用户ID
     */
    @Schema(description = "操作用户ID", example = "1")
    @TableField("user_id")
    private Integer userId;

    /**
     * 操作用户名称
     */
    @Schema(description = "操作用户", example = "admin")
    @TableField("user_name")
    private String username;

    /**
     * 操作时间
     */
    @Schema(description = "操作时间", example = "2021-05-08 15:07:00")
    @TableField(value = "start_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 消耗时间
     */
    @Schema(description = "消耗时间", example = "1")
    @TableField("spend_time")
    private Long spendTime;

    /**
     * 根路径
     */
    @Schema(description = "根路径", example = "http://localhost:8080")
    @TableField("base_path")
    private String basePath;

    /**
     * URI
     */
    @Schema(description = "URI", example = "/sys/user")
    @TableField("uri")
    private String uri;

    /**
     * URL
     */
    @Schema(description = "URL", example = "http://localhost:8080/sys/user")
    @TableField("url")
    private String url;

    /**
     * 请求类型
     */
    @Schema(description = "请求类型", example = "POST")
    @TableField("method")
    private String method;

    /**
     * 请求Java类
     */
    @Schema(description = "请求Java类", example = "com.hippo.core.controller.SysUserController")
    @TableField("class_name")
    private String className;

    /**
     * 请求Java方法
     */
    @Schema(description = "请求Java方法", example = "com.hippo.core.controller.SysUserController")
    @TableField("class_method")
    private String classMethod;

    /**
     * IP地址
     */
    @Schema(description = "发送方IP地址", example = "xxxx.xxx.xxx")
    @TableField("ip")
    private String ip;

    /**
     * 请求参数
     */
    @Schema(description = "返回结果", example = "{'id':1}")
    @TableField("result")
    private String result;
    /**
     * 请求参数
     */
    @Schema(description = "请求参数", example = "{'id':1}")
    @TableField("request_parameter")
    private String requestParameter;


    /**
     * 请求返回的结果
     */
    @Schema(description = "创建时间", example = "2021-05-08 15:07:00")
    @TableField(value="create_time",fill= FieldFill.INSERT) //自动填充
    private LocalDateTime createTime;
}
